<?php
defined('_JEXEC') or die('Restricted access');
$isFilters = ('filters' == JRequest::getVar('layout'));
$showAreas = (1 < count($this->searchareas['search']));
?>
<div id="search_filter_options_element">
	<div id="search_filter_options">
		<h3><a name="search_filters"><?php echo JText::_('COM_SEARCHADVANCED_HEADER_FILTERS');?></a>:</h3>
		
		<fieldset class="">
			<legend><?php echo JText::_('COM_SEARCHADVANCED_FIELDSET_DATEFILTERS'); ?></legend>
			<div id="filters_date_range">
				<span><label for="filters_start"><?php echo JText::_('COM_SEARCHADVANCED_LABEL_FILTER_START'); ?></label>
				<?php echo JHtml::_('calendar', @$this->searchfilters['start'].'', 'filters[start]', 'filters_start', '%Y-%m-%d', 'class="textinput"'); ?></span>
				<span><label for="filters_end"><?php echo JText::_('COM_SEARCHADVANCED_LABEL_FILTER_END'); ?></label>
				<?php echo JHtml::_('calendar', @$this->searchfilters['end'].'', 'filters[end]', 'filters_end', '%Y-%m-%d', 'class="textinput"'); ?></span>
			</div>
		</fieldset>
		<div class="search_clear"></div>
		<?php if ($showAreas): ?>
		<fieldset class="search_area search_50 f_rght">
			<legend><?php echo JText::_('COM_SEARCHADVANCED_FIELDSET_AREAFILTERS'); ?></legend>
			<div class="f_lft">
			<?php
				$i = 0;
				foreach ($this->searchareas['search'] as $val => $txt) :
					$checked = is_array( $this->searchareas['active'] ) && in_array( $val, $this->searchareas['active'] ) ? 'checked="true"' : '';
			?>
				<div class="search_area_item">
					<input type="checkbox" name="areas[]" value="<?php echo $val;?>" id="area_<?php echo $val;?>" <?php echo $checked;?> />
					<label for="area_<?php echo $val;?>">
						<?php echo JText::_($txt); ?>
					</label>
				</div>
				<?php if ($i++ && $i % 8 == 0) : ?>
			</div>
			<div class="f_lft">
				<?php endif; ?>
			<?php endforeach; ?>
			</div>
		</fieldset>
		<?php endif; ?>
		<fieldset<?php if ($showAreas): ?> class="search_50 f_lft"<?php endif; ?>>
			<legend><?php echo JText::_('COM_SEARCHADVANCED_FIELDSET_CATIDFILTERS'); ?></legend>
			<?php echo $this->lists['categories']; ?>
		</fieldset>
		<div class="search_clear"></div>
	</div>
</div>